package xkp.lesson.utils;

import oracle.jdbc.driver.OracleDriver;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class DBUtils {
    public static Connection openConn() throws ClassNotFoundException, SQLException {
        String user = "student";
        String password = "student";
        String url = "jdbc:oracle:thin:@localhost:1521:orcl";
        String driver = "oracle.jdbc.driver.OracleDriver";

        //把注册驱动到驱动管理器
        Class.forName(driver);

        return DriverManager.getConnection(url,user,password);
    }
}
